<!--#include file="Config.asp" -->
<!--#include file="HeadTop.asp"-->

<%
set rs=server.createobject("adodb.recordset")
userid=session("AnyPIM_userID")
ActionType=Trim(request("ActionType"))
ContactID=int(request("ContactID"))
birthmon=int(request("birthmon"))
birthday=int(request("birthday"))

'保存新增的联系人
if ActionType="SaveAddContact" And request("name")<>"" then
sql="select * from Contact_info"
rs.open sql,conn,3,3
rs.addnew()
rs("userid")=userid
rs("name")=Trim(request("name"))
rs("birthday")=birthday '严格的数字
rs("birthmon")=birthmon '严格的数字
rs("sex")=int(request("sex")) '严格的数字
rs("gid")=int(request("gid"))
rs("remark")=Trim(request("remark"))
rs.update
rs.close
set rs=nothing
response.redirect "Index.asp"
response.end
end If

'修改联系人信息
if ActionType="SaveModContact" And request("name")<>"" then
   sql="select * from Contact_info where id="&ContactID
   rs.open sql,conn,3,3
      if rs.eof or rs.bof then
          response.write "<script laguage=javascript>alert('无此记录！');</script>"
          response.end
       end if
rs("userid")=userid
rs("name")=Trim(request("name"))
rs("birthday")=birthday
rs("birthmon")=birthmon
rs("sex")=int(request("sex"))
rs("gid")=int(request("gid"))
rs("remark")=request("remark")
rs.update
rs.close
set rs=nothing
response.redirect "ContactDetail.asp?ID="&ContactID
response.end
end If

'添加保存联系人的属性信息
If ActionType="SaveAddPro" And request("content")<>"" then
sql="select * from Contact_Property where id is null"
rs.open sql,conn,3,3
rs.addnew()
rs("ProTypeID") =int(Request("ProTypeID"))
rs("ContactID")=ContactID
rs("Content")=Trim(Request("Content"))
rs("DoTime")=now()
rs("userid")=UserID
rs.Update
rs.close
set rs=nothing
response.redirect "ContactDetail.asp?ID="&ContactID
response.end
end if

'conn.close
'set conn=nothing

'response.redirect Request.ServerVariables("Http_referer")
%>
